-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK-2309 cache link data when initialization is deferred #1369
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1369 +/- ##
==========================================
+ Coverage 51.03% 51.16% +0.13%
==========================================
Files 66 66
Lines 10126 10133 +7
Branches 3714 3718 +4
==========================================
+ Hits 5168 5185 +17
+ Misses 4700 4692 -8
+ Partials 258 256 -2 ☔ View full report in Codecov by Sentry. |
…kes priority anyway
# Conflicts: # Sources/BranchSDK/Branch.m
What does the latest Allow init calls to come in late. commit do? |
} | ||
} | ||
#endif | ||
|
||
// Handle case where there's no URI scheme or Universal Link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code assumed that there would be a follow up link lifecycle call, but with delayed init that call may have already happened and the associated link saved off.
Currently researching if this change has side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some testing this appears to be a legacy check that hasn't been required in a long time. It did negatively impact apps are are using just an AppDelegate
on cold launch with a delayed init. Removing the check fixes the issue.
Added comment to code view. Still researching if this change is correct. |
if (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey] && ![options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) { | ||
[self initUserSessionAndCallCallback:YES sceneIdentifier:nil urlString:nil]; | ||
} | ||
[self initUserSessionAndCallCallback:YES sceneIdentifier:nil urlString:pushURL]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment if there are any assumptions about from which lifecycle call(s) this must go through?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we assumed that initSession always came first, and other lifecycle calls would follow. With the delay feature, we cannot assume that anymore and cache away links arriving from other lifecycle calls. So now there are no assumptions about where the initSession is coming from.
Reference
SDK-2309 Cache link data when initialization is deferred
Summary
On React Native we had a caching mechanism to store links until the JS layer was ready. This is not working properly when using the optional deferred init on iOS. This moves the caching to the native iOS layer.
Motivation
Fix cold link open when using deferred init on iOS with React Native
Type Of Change
Testing Instructions
Enable deferred init with the
branch.json
Add a delayed
notifyNativeToInit
Install app, but make sure it is fully closed
Open the app with a universal link
Without this change the link will be ignored.
With this change the link will be used with the deferred init.
Also need to test this on React Native.
cc @BranchMetrics/saas-sdk-devs for visibility.